Upgrade rustup used on AppVeyor
authorAlex Crichton <alex@alexcrichton.com>
Thu, 4 May 2017 21:50:57 +0000 (14:50 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 5 May 2017 14:27:22 +0000 (07:27 -0700)
appveyor.yml
tests/cargotest/lib.rs

index 74c51dce68d41a2672546876dc90860ca3eefc96..7c3597b042daf19635cc9f8ed6afa7a786a81925 100644 (file)
@@ -28,8 +28,7 @@ install:
   - if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
   - if defined MINGW_URL set PATH=%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
 
-  # FIXME(#3394) use master rustup
-  - curl -sSfO https://static.rust-lang.org/rustup/archive/0.6.5/x86_64-pc-windows-msvc/rustup-init.exe
+  - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
   - rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly-2017-03-03
   - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
   - if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%
index 15dc956cae84a6f6064c71a8b5f13f1d3c77b396..8446fa829eaa3abdb1bb7e286bd0f33acd473e11 100644 (file)
@@ -18,11 +18,12 @@ extern crate url;
 #[cfg(windows)] extern crate kernel32;
 #[cfg(windows)] extern crate winapi;
 
-use cargo::util::Rustc;
 use std::ffi::OsStr;
 use std::time::Duration;
-use std::path::PathBuf;
-use std::env;
+use std::path::{Path, PathBuf};
+
+use cargo::util::Rustc;
+use cargo::util::paths;
 
 pub mod support;
 pub mod install;
@@ -69,31 +70,21 @@ fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
 
     // We'll need dynamic libraries at some point in this test suite, so ensure
     // that the rustc libdir is somewhere in LD_LIBRARY_PATH as appropriate.
-    // Note that this isn't needed on Windows as we assume the bindir (with
-    // dlls) is in PATH.
-    if cfg!(unix) {
-        let var = if cfg!(target_os = "macos") {
-            "DYLD_LIBRARY_PATH"
-        } else {
-            "LD_LIBRARY_PATH"
-        };
-        let rustc = RUSTC.with(|r| r.path.clone());
-        let path = env::var_os("PATH").unwrap_or(Default::default());
-        let rustc = env::split_paths(&path)
-                        .map(|p| p.join(&rustc))
-                        .find(|p| p.exists())
-                        .unwrap();
-        let mut libdir = rustc.clone();
-        libdir.pop();
-        libdir.pop();
-        libdir.push("lib");
-        let prev = env::var_os(&var).unwrap_or(Default::default());
-        let mut paths = env::split_paths(&prev).collect::<Vec<_>>();
-        println!("libdir: {:?}", libdir);
-        if !paths.contains(&libdir) {
-            paths.push(libdir);
-            p.env(var, env::join_paths(&paths).unwrap());
-        }
+    let mut rustc = RUSTC.with(|r| r.process());
+    let output = rustc.arg("--print").arg("sysroot").exec_with_output().unwrap();
+    let libdir = String::from_utf8(output.stdout).unwrap();
+    let libdir = Path::new(libdir.trim());
+    let libdir = if cfg!(windows) {
+        libdir.join("bin")
+    } else {
+        libdir.join("lib")
+    };
+    let mut paths = paths::dylib_path();
+    println!("libdir: {:?}", libdir);
+    if !paths.contains(&libdir) {
+        paths.push(libdir);
+        p.env(paths::dylib_path_envvar(),
+              paths::join_paths(&paths, paths::dylib_path_envvar()).unwrap());
     }
     return p
 }